package com.realgodo.site.entity.application.communication;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.realgodo.site.entity.IdEntity;
import com.realgodo.site.entity.space.Space;

@Entity
public class Comment extends IdEntity {

	private static final long serialVersionUID = -5131877868136583358L;

	private Space space;

	private Long applicationId;

	private String title;

	private String content;

	private Date createDate = new Date();

	@ManyToOne
	@JoinColumn(name = "space_id", referencedColumnName = "id", nullable = false)
	public Space getSpace() {
		return space;
	}

	public void setSpace(Space space) {
		this.space = space;
	}

	@Column(name = "application_id", nullable = false)
	public Long getApplicationId() {
		return applicationId;
	}

	public void setApplicationId(Long applicationId) {
		this.applicationId = applicationId;
	}

	@Column
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "content", length = 500)
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_date", insertable = true, updatable = true)
	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

}
